x86: fix frame table initialization when hotplug memory regions were detected
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 4 Feb 2010 08:53:16 +0000 (08:53 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 4 Feb 2010 08:53:16 +0000 (08:53 +0000)
max_idx is not a pdx, and hence needs to be converted to one in all
cases where it is being passed to pdx_to_page().

Also, just like for max_pdx, the conversion result of max_idx may
point into an address space hole, and hence it must not be used
directly as an argument to pdx_to_page(). Note that this doesn't apply
to the arguments passed to memset(), as the size argument would be
zero in the case of hitting an address space hole.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen/arch/x86/mm.c

index 5f457e6af4c395e14b0b2eeabb20fd5dc44f9060..cab20a6f661d52893f385d0e1051c74eb2000fe7 100644 (file)
@@ -225,10 +225,11 @@ void __init init_frametable(void)
                               pdx_to_page(max_pdx - 1) + 1);
     else
     {
-        init_frametable_chunk(pdx_to_page(sidx *PDX_GROUP_COUNT),
-                              pdx_to_page(max_idx * PDX_GROUP_COUNT));
-        memset(pdx_to_page(max_pdx), -1, (unsigned long)pdx_to_page(max_idx) -
-                        (unsigned long)(pdx_to_page(max_pdx)));
+        init_frametable_chunk(pdx_to_page(sidx * PDX_GROUP_COUNT),
+                              pdx_to_page(max_idx * PDX_GROUP_COUNT - 1) + 1);
+        memset(pdx_to_page(max_pdx), -1,
+               (unsigned long)pdx_to_page(max_idx * PDX_GROUP_COUNT) -
+               (unsigned long)pdx_to_page(max_pdx));
     }
 }